package com.atguigu.gulimall.ware.dao;

import com.atguigu.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author lxx
 * @email 1914264274@qq.com
 * @date 2022-03-08 15:42:01
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void updateStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    Integer selectSkuStock(@Param("skuId") Long skuId);

    List<Long> listWareIds(@Param("skuId") Long skuId);

    Integer lockStock(@Param("skuId") long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

    void releaseStock(@Param("skuId") long skuId, @Param("num") Integer num, @Param("wareId") long wareId);
}


